<template>
	<view>
			
		<!-- <u-notice-bar v-if="newShow" @click="goNew" mode="horizontal" :list="notice"></u-notice-bar> -->
		
		<view v-if="role==2 || role ==3"
			style="background: #3464D6;display: inline-block;width: 100%;padding-bottom: 40rpx;">
			<view style="display: flex;justify-content: flex-end;margin: 20rpx;">
				<u-button v-if="role==3" @click="go" type="primary" size="mini"
					:custom-style="{backgroundColor:'#fff',fontSize:'24rpx',color:'#2D9AFE'}" shape="circle"> 我要提现
				</u-button>
			</view>
			<view class="u-flex u-row-around u-text-center u-margin-top-60" style="color: #fff;">
				<view>
					<view style="font-size: 40rpx;font-weight: bold;">
						￥{{menony}}
					</view>
					<view class="u-margin-top-20">余额</view>
				</view>
				<view>
					<view style="font-size: 40rpx;font-weight: bold;">
						{{user_num}}
					</view>
					<view class="u-margin-top-20">会员数量</view>
				</view>
			</view>
		</view>

		<List :list="list" v-if="role"></List>

		<!-- <u-loadmore :status="initial.status" /> -->
		
		
		<view style="text-align: center;margin-top: 100rpx;" v-if="newShow" @click="goNew">
			<image style="width: 250rpx;height: 250rpx;"
			:src="url+'/uploads/user/images/20220521/874f8252a4c2a074a773ea2359ebffd7.png'"></image>
			<view style="color: #0064C6;">请注意查收信息</view>
			
		</view>
		
	</view>
</template>

<script>
	import baseUrl from '../../common/baseUrl.js';
	import loader from '@/common/loadPage.js';

	import List from './components/storeList.vue';
	export default {
		components: {
			List
		},
		mixins: [loader],
		data() {
			return {
				url:'',
				notice: ['吉吉车客服提醒您有最新消息，请及时关注哦~'],
				nav: [{
					name: '车位'
				}, {
					name: '订单'
				}],
				current: 0,
				list: [],
				initial: {
					page: 1,
					geturl: "/api/alliance/store",
					parm: {

					},
					isPage: true
				},
				menony: "",
				user_num: '',
				role: '',
				newShow:false

			}
		},
		methods: {
			message(){
				this.$u.post('/api/Alliance/message	', {}).then(res => {
					 if(res.length){
						 this.newShow=true
					 }
				}).catch(err => {})
			},

			infomation() {

				return new Promise((resolve, reject) => {
					this.$u.api.userInfo().then(res => {
						this.role = res.role;
						resolve(res)
				 }).catch(err => {

					})
				})

			},

			jiazai() {

				this.$u.post('/api/alliance/info', {}).then(res => {
					this.menony = res.balance;
					this.user_num = res.userNum
				}).catch(err => {})
			},
			change(index) {
				this.current = index;
			},
			go() {
				uni.navigateTo({
					url: "../tixian/index"
				})
			},
			goNew(){
				uni.navigateTo({
					url:'./new'
				})
			}
		},
		async onLoad() {
this.url=baseUrl.url
			await this.infomation()
			this.getGoods()
			this.jiazai()
			this.message()

		}
	}
</script>

<style>
</style>
